<runtime:VisualPart
	x:Class="VideoPlayerAddIn.VideoPlayer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:runtime="clr-namespace:ViewOnCore.Visual;assembly=ViewOnCore"
    xmlns:globalProperties="clr-namespace:ViewOnCore.Properties;assembly=ViewOnCore"
    xmlns:properties="clr-namespace:VideoPlayerAddIn.Properties"
    xmlns:wpf="clr-namespace:ViewOnCore.Helper.WPF;assembly=ViewOnCore">

    <runtime:VisualPart.RenderTransform>
        <TransformGroup>
            <ScaleTransform ScaleX="1" ScaleY="1" />
            <RotateTransform Angle="0" />
            <TranslateTransform X="0" Y="0" />
        </TransformGroup>
    </runtime:VisualPart.RenderTransform>

    <runtime:VisualPart.Resources>

        <!-- Context menu -->
        <ContextMenu x:Key="ContextMenu">
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_OpenFile}"/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_OpenURL}"/>
            <Separator/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_Play}"/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_Backward}"/>
            <Separator/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_FullScreen}"/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_FitSize}"/>
            <MenuItem Header="{x:Static properties:Globalization.VideoPlayer_DoubleSize}"/>
        </ContextMenu>

        <Storyboard x:Key="SetMouseInactiveInner">
            <Storyboard>
                <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="borControl" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>

        <Storyboard x:Key="SetMouseActiveInner">
            <Storyboard>
                <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetName="borControl" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>

        <Storyboard x:Key="SetMouseInactiveStoryboard">
            <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="headerBar" Storyboard.TargetProperty="Opacity" />
            <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="grip" Storyboard.TargetProperty="Opacity" />
        </Storyboard>
        <Storyboard x:Key="SetMouseActiveStoryboard">
            <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetName="headerBar" Storyboard.TargetProperty="Opacity" />
            <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetName="grip" Storyboard.TargetProperty="Opacity" />
        </Storyboard>
    </runtime:VisualPart.Resources>

    <Grid Background="Black" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="32"/>
        </Grid.RowDefinitions>

        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.RowSpan="2">
            <Viewbox x:Name="viewBox" Stretch="None" HorizontalAlignment="Center" VerticalAlignment="Center">
                <MediaElement x:Name="mediaElement" LoadedBehavior="Manual"/>
            </Viewbox>
            <Border x:Name="mediaElementLayer" Background="#00FFFFFF" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            <wpf:Spinner x:Name="spinner" Visibility="Collapsed"/>
        </Grid>

        <!-- Control bar -->
        <Border x:Name="borControl" Grid.Row="1" Background="{DynamicResource VOColor11}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="64"/>
                    <ColumnDefinition Width="32"/>
                    <ColumnDefinition Width="32"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="100"/>
                    <ColumnDefinition Width="20"/>
                    <ColumnDefinition Width="80"/>
                    <ColumnDefinition Width="32"/>
                </Grid.ColumnDefinitions>

                <wpf:SplitButton x:Name="sbOpenVideo" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <wpf:SplitButtonItem IsSelected="True">
                        <Image Width="24" Height="24" Source="pack://application:,,,/_images/generic/folder_open.png"/>
                    </wpf:SplitButtonItem>
                    <wpf:SplitButtonItem>
                        <Image Width="24" Height="24" Source="pack://application:,,,/_images/generic/web_open.png"/>
                    </wpf:SplitButtonItem>
                </wpf:SplitButton>

                <!-- Pause/Play -->
                <Button x:Name="btnPlay" Grid.Column="1" Style="{DynamicResource Button.TransparentWithEffect4}" Width="20" Height="20" VerticalAlignment="Center">
                    <Grid>
                        <Path
									  x:Name="patPlay"
									  HorizontalAlignment="Center"
									  Width="7"
									  Height="12"
									  Data="M0,100 L0,0 60,50 z"
									  Stretch="Fill"
									  Fill="{DynamicResource VOGradient01}"
									  Stroke="{DynamicResource VOGradient02}"/>
                        <StackPanel x:Name="patPause" Visibility="Collapsed" Orientation="Horizontal" HorizontalAlignment="Center">
                            <Path
										  Width="3"
										  Height="12"
										  Data="M0,0 20,0 20,100 0,100 z"
										  Stretch="Fill"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"/>
                            <Path
										  Margin="2,0,0,0"
										  Width="3"
										  Height="12"
										  Data="M0,0 20,0 20,100 0,100 z"
										  Stretch="Fill"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"/>
                        </StackPanel>
                    </Grid>
                </Button>

                <!-- Restart -->
                <Button x:Name="btnPrevious" Grid.Column="2" Style="{DynamicResource Button.TransparentWithEffect4}" Width="15" Height="15">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                        <Path
									  Width="6"
									  Height="11"
									  Data="M60,100 L60,0 0,50 z"
									  Stretch="Fill"
									  Fill="{DynamicResource VOGradient01}"
									  Stroke="{DynamicResource VOGradient02}"/>
                        <Path
									  Width="6"
									  Height="11"
									  Data="M60,100 L60,0 0,50 z"
									  Stretch="Fill"
									  Fill="{DynamicResource VOGradient01}"
									  Stroke="{DynamicResource VOGradient02}"/>
                    </StackPanel>
                </Button>

                <!-- Progress -->
                <Slider x:Name="sliPosition" Grid.Column="3" Style="{DynamicResource Slider.PositionWithEffect4}" Maximum="100" LargeChange="10" HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
                <TextBlock
                    x:Name="txtProgress"
                    Grid.Column="4"
                    Text="0:0:0/0:0:0"
                    Foreground="{DynamicResource VOColor1A}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"/>

                <!-- Volume -->
                <Button x:Name="btnMute" Grid.Column="5" Style="{DynamicResource Button.TransparentWithEffect4}" Margin="2,0,2,0" Width="15" Height="15">
                    <Grid>
                        <StackPanel x:Name="patMuteOn" Orientation="Horizontal" HorizontalAlignment="Center">
                            <Path
										  Width="2"
										  Height="6"
										  Data="M0,40 0,60"
										  Stretch="Fill"
										  VerticalAlignment="Center"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"/>
                            <Path
										  Margin="1,0,0,0"
										  Width="4"
										  Height="14"
										  Data="M20,35 80,0 80,100 20,65 z"
										  Stretch="Fill"
										  VerticalAlignment="Center"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"
                />
                        </StackPanel>
                        <StackPanel x:Name="patMuteOff" Orientation="Horizontal" HorizontalAlignment="Center" Visibility="Collapsed">
                            <Path
										  Width="2"
										  Height="6"
										  Data="M0,40 0,60"
										  Stretch="Fill"
										  VerticalAlignment="Center"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"/>
                            <Path
										  Margin="1,0,0,0"
										  Width="4"
										  Height="14"
										  Data="M20,35 80,0 80,100 20,65 z"
										  Stretch="Fill"
										  VerticalAlignment="Center"
										  Fill="{DynamicResource VOGradient01}"
										  Stroke="{DynamicResource VOGradient02}"
                />
                            <Canvas Width="6" Height ="6" VerticalAlignment="Center" Margin="1,0,0,0">
                                <Line X1="0" Y1="0" X2="6" Y2="6" Stroke="{DynamicResource VOGradient02}"/>
                                <Line X1="0" Y1="6" X2="6" Y2="0" Stroke="{DynamicResource VOGradient02}"/>
                            </Canvas>
                        </StackPanel>
                    </Grid>
                </Button>
                <Slider x:Name="sliVolume" Grid.Column="6" Style="{DynamicResource Slider.VolumeWithEffect4}" Maximum="100" LargeChange="10" Value="0" Width="72" VerticalAlignment="Center"/>

                <!-- Full screen -->
                <Button x:Name="btnFullScreen" Grid.Column="7" Style="{DynamicResource Button.TransparentWithEffect4}">
                    <Grid>
                        <Grid x:Name="griFullScreen">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Path
											Grid.Row="0"
											Grid.Column="0"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="45"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="0"
											Grid.Column="1"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="135"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="1"
											Grid.Column="0"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-45"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="1"
											Grid.Column="1"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-135"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                        <Grid x:Name="griNormalScreen" Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <Path
											Grid.Row="0"
											Grid.Column="0"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-135"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="0"
											Grid.Column="1"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="-45"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="1"
											Grid.Column="0"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="135"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Path
											Grid.Row="1"
											Grid.Column="1"
											Width="8"
											Height="8"
											Data="M0,0 60,-60 60,-15 120,-15 120,15 60,15 60,60 z"
											Stretch="Fill"
											Fill="{DynamicResource VOGradient01}"
											Stroke="{DynamicResource VOGradient02}" RenderTransformOrigin="0.5,0.5">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                        <SkewTransform AngleX="0" AngleY="0"/>
                                        <RotateTransform Angle="45"/>
                                        <TranslateTransform X="0" Y="0"/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                        </Grid>
                    </Grid>
                </Button>

            </Grid>
        </Border>

        <!-- Error Message -->
        <TextBlock
					   x:Name="txtError"
					   Text="{x:Static properties:Globalization.VideoWindow_UnableToLoadVideo}"
					   Foreground="{DynamicResource VOColor20}"
					   HorizontalAlignment="Center"
					   VerticalAlignment="Center"
					   FontSize="22"
					   FontWeight="Bold"
					   Visibility="Collapsed"/>

    </Grid>

</runtime:VisualPart>
